package com.etc.service.impl;

import com.etc.mapper.SightDetailDao;
import com.etc.pojo.Admin;
import com.etc.pojo.SightDetail;
import com.etc.service.SightDetailService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class SightDetailImpl implements SightDetailService {

    @Autowired
    SightDetailDao dao;


    /**
     * 模糊查询景点
     * */
    @Override
    public PageInfo<SightDetail> selectSightDetailByName(String sightName, int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<SightDetail> list = dao.selectSightDetailByName(sightName);
        PageInfo<SightDetail> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

    /**
     * 修改景点
     * */
    @Override
    public boolean modifySightDetail(int sightId,String sightName, String sightAdd, String sightPrice, String sightOpenTime, String sightDescribe, String sightImg, String sightStatus) {
        int i=dao.modifySightDetail(sightId,sightName,sightAdd,sightPrice,sightOpenTime,sightDescribe,sightImg,sightStatus);
        return i>0;
    }

    /**
     * 添加景点
     * */
    @Override
    public boolean addSightDetail(String sightName, String sightAdd, String sightPrice, String sightOpenTime, String sightDescribe, String sightImg, String sightStatus) {
        int i = dao.addSightDetail(sightName,sightAdd,sightPrice,sightOpenTime,sightDescribe,sightImg,sightStatus);
        return i>0;
    }


    /**
     * 删除景点
     * */
    @Override
    public int delSightDetail(int sightId) {
        return dao.delSightDetail(sightId);
    }


}
